

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@include file="/WEB-INF/templates/common/taglib.jsp"%>

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"> 
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta http-equiv="Access-Control-Allow-Origin" content="*">
<title>${title}</title>
<%@include file="/WEB-INF/templates/common/common.jsp"%>

<script type="text/javascript" src="${basePath}/static/page/js/jqPaginator.js"></script>
<script type="text/javascript" src="${basePath}/static/My97DatePicker/WdatePicker.js"></script>
<script  type="text/javascript" src="${basePath}/static/js/util.js"></script>
<script  type="text/javascript" src="${basePath}/static/layer/layer.js"></script>
<link href="${basePath}/static/layer/layer_style.css" rel="stylesheet" type="text/css">

</head>
<body>

</head>
<body>
 <!--头部-->
 <%@include file="/WEB-INF/templates/common/header.jsp"%>

<!------导航条-->
 <%@include file="/WEB-INF/templates/common/navigation.jsp"%>

<div class="list_main lay_out">
 <div class="list_DH">
    <!--打印模块导航栏-->
 <%@include file="/WEB-INF/templates/common/printnav.jsp"%>
 </div>
 <div class="list_NR">
  <div class="loc">
   <h3>审核记录查询</h3>
  </div>
 
  <div class="list_con_table"> 
   <div class="search_table">
    <ul id="table_ul">
    <li class="Label_1" style="width:8%">姓名：&nbsp;</li>
    <li class="Label_2"><input class="input_box" type="text" maxlength="40" name='name' id='name' value='${count}' /></li>
    <li class="Label_1" style="width:11%">病案号：</li>
    <li class="Label_2"><input class="input_box" type="text"  maxlength="60" name='' id='onlyId' value='' /></li>
  	<li class="Label_1" style="width:11%">出院日期：&nbsp;</li>
    <li class="Label_2" style="width:30%;text-align:left">
        <input style="width:40%;margin-left:5px" class="input_box" id="outHospitalStartDate" value='' onFocus="WdatePicker()" type="text" > 
         - <input style="width:40%" class="input_box" id="outHospitalEndDate"  value='' onFocus="WdatePicker()" type="text" >
    </li>
    <input type="hidden" id="pageNoHidden" value="1"/>
    
   <li class="Label_1" style="width:8%">ID号：&nbsp;</li>
    <li class="Label_2"><input class="input_box" type="text" maxlength="40" name='' id='mrId' value='' /></li>
    <li class="Label_1" style="width:11%">住院次数：</li>
    <li class="Label_2"><input class="input_box" type="text"  maxlength="60" name='' id='visitNumber' value='' /></li>
  	<li class="Label_1" style="width:11%">审核时间：&nbsp;</li>
    <li class="Label_2" style="width:30%;text-align:left">
        <input style="width:40%;margin-left:5px" class="input_box" id="checkStartTime" value='' onFocus="WdatePicker()" type="text" > 
         - <input style="width:40%" class="input_box" id="checkEndTime"  value='' onFocus="WdatePicker()" type="text" >
    </li>
    <li class="Label_5">
	   <a onclick="findMr(1,10)">查询</a>
    </li>
    </ul>
  </div>
  <table class="Search_tableList" cellpadding="0" cellspacing="0">
		      <tr>
			      <td class="tdLabel_4">姓名</td>
			      <td class="tdLabel_4">身份证号</td>
			      <td class="tdLabel_4">ID号</td>
			      <td class="tdLabel_4">住院次数</td>
			      <td class="tdLabel_4">出院时间</td>
			      <td class="tdLabel_4">审核时间</td>
			      <td class="tdLabel_4">审核状态</td>
			      <td class="tdLabel_4">操作</td>
		      </tr>
		      <tr id="loading" style="height:50px;display:none">
	             <td colspan="8" align="center" ><img src="${basePath}/static/layer/skin/default/loading-2.gif"></td>
	          </tr>
		      <tbody id="tbody">
		          
		      </tbody>
     </table>
     <div class="pageList">
       <ul class="pagination clearfix" id="page_plus"></ul>
       <div class="pagination">
            <div>总共：<b id="totalPage">0</b> 条信息    当前页是第 <b id="currentPage">0/0</b>　页</div>
       </div>          
    </div> 
 </div>
</div>
</div>
<!--页脚部分-->
<%@include file="/WEB-INF/templates/common/footer.jsp"%>
 <script>
 
 	function updateCheckStatus(obj){
 		layer.confirm("您确认取消此份病案的审核吗?请确认!", {
            btn : [ '确认', '取消' ]//按钮
        }, function(index) {
        	layer.close(index);
        	var $this = $(obj);
     		var funId = $this.attr("funId");
        	$.ajax({
        		type:"post",
        		data:{funId:funId},
        		url:"${basePath}/print/updateCheckStatus",
        		success:function(data){
        			
        			var pageNoHidden =$("#pageNoHidden").val();
        			findMr(parseInt(pageNoHidden),10);
        		}
        		
        	})
        	
        }); 	
 		
 	
 	}
 
 	function findMr(pageNo,pageSize){
 	
 		var name=$("#name").val();		
 		var outHospitalStartDate=$("#outHospitalStartDate").val();
    	var outHospitalEndDate=$("#outHospitalEndDate").val();
    	var mrId = $("#mrId").val();
    	var onlyId = $("#onlyId").val();
    	var visitNumber = $("#visitNumber").val();
    	var checkStartTime = $("#checkStartTime").val();
    	var checkEndTime = $("#checkEndTime").val();
 		
    	if(!name && !onlyId && !mrId && !visitNumber && !outHospitalStartDate && !outHospitalEndDate && !checkStartTime && !checkEndTime ){
 			layer.alert('查询条件不能为空', {icon: 0}); 
 			return;
 		}
 		
 		$.ajax({
 			type:"post",
 			url:"${basePath}/print/selectMedPrintCheck",
 			data:{name:name,outHospitalStartDate:outHospitalStartDate,
 				outHospitalEndDate:outHospitalEndDate,mrId:mrId,onlyId:onlyId,
 				visitNumber:visitNumber,checkStartTime:checkStartTime,checkEndTime:checkEndTime,pageNo:pageNo,pageSize:pageSize},	 
 			beforeSend:function(){
 				$("#tbody").html("");
 				$("#loading").show();
 			},
 			success:function(data){
 				$("#loading").hide();
	 			if(data.success){
	 				console.log(data);
	 				var totalCounts= data.data.count;
	 				initPage(totalCounts,pageSize,pageNo);
	 				$("#pageNo").val(pageNo);
	 				var hospitalizationNotes=data.data.noteList;
	 				var len=hospitalizationNotes.length;
	 				if(len>0){
		 				var html="";
		 				for(var i=0;i<hospitalizationNotes.length;i++){
		 					var mrBasic=hospitalizationNotes[i];
		 					html+="<tr>"+
		 					      " <td  class='tdLabel_5'>"+mrBasic.name+"</td>"+
		 					      " <td  class='tdLabel_5'>"+(mrBasic.idNumber==undefined?'':mrBasic.idNumber)+"</td>"+
		 					      " <td  class='tdLabel_5'>"+(mrBasic.mrId==undefined?'':mrBasic.mrId)+"</td>"+
		 					      " <td  class='tdLabel_5'>"+(mrBasic.visitNumber==undefined?'':mrBasic.visitNumber)+"</td>"+
		 					   	  " <td  class='tdLabel_5'>"+mrBasic.out_hospital_date+"</td>"+
		 					      " <td  class='tdLabel_5'>"+mrBasic.checkTime+"</td>"+
		 					      " <td  class='tdLabel_5'>已审核</td>"+
		 					      " <td  class='tdLabel_5'><a class='int'  funId='"+mrBasic.funId+"' onclick='updateCheckStatus(this)'>删除</a></td>"+
		 					      "</tr>";
		 				}
		 				$("#tbody").html(html);
	 				}else{
	 					layer.alert("查询数据为空!",{icon: 5});
						$("#tbody").html("");
		                $("#currentPage").html("0/0");
						$("#totalPage").html("0");
						$("#page_plus").html("");
	 				}
	 			}else{
	 				layer.alert(data.msg,{icon:5})
					$("#tbody").html("");
	                $("#currentPage").html("0/0");
					$("#totalPage").html("0");
					$("#page_plus").html("");
	 			}
 			}
 		})
 	}
	
	function page(currentPage,totalCounts){
	
	var totalCounts = totalCounts;
 		var pageSize = 10;
 		var totalPages = Math.ceil(totalCounts/pageSize);
 		$("#ston_page_msg").text(totalPages);
 		
 		$("#Pagination").pagination(totalPages,{
 		current_page:currentPage,
 	  callback: function (page_index,jp) {
 		findMr(page_index,pageSize);
 	  } 
 	  
 	  });
	}
	
  //分页
	function initPage(totalCounts,pageSize,currentPage){
		 var visiblePages = 5;
		 var totalPages =Math.ceil(totalCounts/pageSize);
		 $("#totalPage").html(totalCounts);
		 if(totalCounts < 1){
		 	$("#currentPage").html(0+"/"+totalPages);
		 	$("#page_plus").html("");
		 	return;
		 }
		 
         $("#currentPage").html(currentPage+"/"+totalPages);
         
		 $('#page_plus').jqPaginator({

		        totalCounts: totalCounts,
		        pageSize:pageSize,
		        visiblePages: visiblePages,
		        currentPage: currentPage,

		        first:'<li class="first"><a href="javascript:void(0);">首页</a></li>',
		        prev: '<li class="prev"><a href="javascript:void(0);">上一页</a></li>',
		        next: '<li class="next"><a href="javascript:void(0);">下一页</a></li>',
		        last: '<li class="last"><a href="javascript:void(0);">末页</a></li>',
		        page: '<li class="page"><a href="javascript:void(0);">{{page}}</a></li>',
		        onPageChange: function (page,type) {
		        	if(type !='init'){
		        		findMr(page,pageSize);
			        }
		        }
		    });

	}	
  
  
  function dirprint(obj){
	  var isMail=1;
	  var printReason=$("#applyReason").val();
	  var name=$(obj).attr("mrName");
	  var mrId=$(obj).attr("mrId");
	  var firstGuid=$(obj).attr("firstGuid");
	  var idCard=$(obj).attr("idCard");
	  var outTime=$(obj).attr("outTime");
	  
	  var index = $(obj).attr("index");
	  var printReason=$("#applyReason"+index).val();
	  var copies=$("#copies"+index).val();
	  
	
/* 	  alert(index+"--"+isMail+"--"+printReason+"--"+copies);
	  
	  return;
	   */
		  window.location.href="${basePath}/print/addPrintRecordPage?firstGuid="+firstGuid+"&printReason="+printReason+"&copies="+copies;
	 
  }
	 
	
	</script>

</body>
</html>
